<template>
  <div>
    <div class="task-info">
			<div v-if="taskInfo.taskdetail.pj_content!=''">
				<div class="task-info-header">
					<i></i>
					<span>任务评价</span>
				</div>
				<div class="task-info-content">
					<div class="row-line-2 clearfix">
						<span class="span-title">评<i class="space-word"></i>分：</span>
						<span class="span-content color-4 weight700">{{taskInfo.taskdetail.pj_score}}分</span>
					</div>
					<div class="row-line-2 clearfix">
						<span class="span-title">评价内容：</span>
						<span class="span-content">{{taskInfo.taskdetail.pj_content}}</span>
					</div>
				</div>
			</div>
      <div class="task-info-header">
        <i></i>
        <span>任务信息</span>
      </div>
      <div class="task-info-content">
        <div class="info-content-top">
          <div class="div-first">
            <div class="row-line-1 color-1 clearfix">
              <p><span>任务来源：</span>{{taskInfo.taskdetail.task_type_text}}</p>
              <p><span>计划日期：</span>{{taskInfo.taskdetail.plan_time}}</p>
            </div>
            <div class="row-line-1 clearfix">
              <p><span>发<i class="space"></i>起<i class="space"></i>人：</span>{{taskInfo.taskdetail.send_user_name}}</p>
              <p><span>截至日期：</span>{{taskInfo.taskdetail.end_time}}</p>
            </div>
            <div class="row-line-1 clearfix">
              <p><span>执<i class="space"></i>行<i class="space"></i>人：</span>{{taskInfo.taskdetail.exec_user_name}}</p>
              <p v-if="taskInfo.taskdetail.cooper_user_name!=''"><span>协<i class="space"></i>同<i class="space"></i>人：</span>{{taskInfo.taskdetail.cooper_user_name}}</p>
              <p v-if="taskInfo.taskdetail.cooper_user_name==''"><span>协<i class="space"></i>同<i class="space"></i>人：</span>无</p>
            </div>
          </div>
          <div class="div-second">
            <div class="row-line-2 clearfix">
              <span class="span-title">任务主题：</span>
              <span class="span-content">{{taskInfo.taskdetail.task_subject}}</span>
            </div>
            <div class="row-line-2 clearfix">
              <span class="span-title">任务内容：</span>
              <span class="span-content" v-html="taskInfo.taskdetail.task_content"></span>
            </div>
          </div>
          <div class="div-third">
            <div class="row-line-2 clearfix" v-if="taskInfo.taskdetail.card_username!=''">
              <span class="span-title">患者姓名：</span>
              <span class="span-content color-3">{{taskInfo.taskdetail.card_username}}</span>
            </div>
            <div class="row-line-2 clearfix" v-if="taskInfo.taskdetail.attach.length>0">
              <span class="span-title">附<i class="space-word"></i>件：</span>
              <span class="span-content">
                <p v-for="(item,index) in taskInfo.taskdetail.attach_names" v-bind:key="index">
                  <a v-if="item.split('.')[1]=='png'||item.split('.')[1]=='jpg'||item.split('.')[1]=='jpeg'" class="color-3" @click="viewImg(taskInfo.taskdetail.attach[index])" href="#">{{item}}</a>
									<a v-else class="color-3" :download="item" :href="taskInfo.taskdetail.attach[index]">{{item}}</a>
                </p>
              </span>
            </div>
          </div>
        </div>
        <div class="info-content-bottom" v-for="(reply,index) in taskInfo.taskdetail.reply_attach" :key="index">
          <div class="row-line-2 clearfix">
            <span class="span-title">执<i class="space"></i>行<i class="space"></i>人：</span>
            <span class="span-content">{{reply.reply_username}}</span>
          </div>
          <div class="row-line-2 clearfix">
            <span class="span-title">任务回复：</span>
            <span class="span-content">{{reply.reply_content}}</span>
          </div>
          <div class="row-line-2 clearfix" v-if="reply.reply_attach.length>0">
            <span class="span-title">附<i class="space-word"></i>件：</span>
            <span class="span-content">
                <p v-for="(item,index) in reply.reply_attach_name" v-bind:key="index">
                  <a v-if="item.split('.')[1]=='png'||item.split('.')[1]=='jpg'||item.split('.')[1]=='jpeg'" class="color-3" @click="viewImg(reply.reply_attach[index])" href="#">{{item}}</a>
									<a v-else class="color-3" :download="item" :href="reply.reply_attach[index]">{{item}}</a>
                </p>
              </span>
          </div>
        </div>
      </div>
    </div>
		<component :is="viewPicture" :dialogViewVisible="dialogViewVisible" :imgs="imgSrc" @updateView="updateView" :showPrint="false"></component>
  </div>
</template>
<style scoped src="./detail.css"></style>
<script>
	import viewPicture from './viewPicture'
  export default{
    props: {
      taskInfo: Object
    },
    data() {
      return {
				viewPicture: viewPicture,
				imgSrc: [],
				dialogViewVisible: false
			}
    },
    created() {
    },
    mounted() {
      // console.log(this.taskInfo.taskdetail.id)
    },
    methods: {
			viewImg (url) {
				this.imgSrc = []
				this.dialogViewVisible = true
				this.imgSrc.push(url)
			},
			updateView (flag) {
				this.dialogViewVisible = flag
			}
    }
  }
</script>
